Skip to content

Add coalesce support in OPL parser and OTAP query-engine planner#2905

Open
Paramesh324 wants to merge 2 commits intoopen-telemetry:mainfrom
Paramesh324:issue_2823
Open

Add coalesce support in OPL parser and OTAP query-engine planner#2905
Paramesh324 wants to merge 2 commits intoopen-telemetry:mainfrom
Paramesh324:issue_2823

Conversation

@Paramesh324
Copy link
Copy Markdown

Change Summary

Add support for coalesce(...) in OPL / OTAP query-engine by:

  • Parsing coalesce calls in the OPL parser into ScalarExpression::Coalesce(CoalesceScalarExpression).
  • Planning ScalarExpression::Coalesce in the columnar query-engine expression planner.
  • Lowering coalesce arguments to a CASE/WHEN logical expression (DataFusion-compatible behavior) to ensure correct execution in the current planning/execution path.
  • Adding parser and planner/execution tests for valid usage and arity validation.

What issue does this PR close?

How are these changes tested?

  • Added OPL parser tests for:
    • valid coalesce(...) parsing
    • invalid arity (fewer than 2 args)
  • Added query-engine expr planner/execution test for coalesce fallback behavior.
  • Ran formatting and checks:
    • cargo fmt --all
    • cargo test -p otap-df-opl --lib
    • cargo test -p otap-df-query-engine --lib pipeline::expr::test
    • cargo clippy -p otap-df-opl -p otap-df-query-engine --all-targets -- -D warnings

Are there any user-facing changes?

Yes.
Users can now use coalesce(...) in OPL expressions for OTAP query-engine pipelines, e.g.:
coalesce(attributes["x"], attributes["y"], "hello")

…≥2 args).

Plan Coalesce in ExprLogicalPlanner by lowering to the same CASE/WHEN shape
DataFusion uses for coalesce, avoiding the coalesce UDF’s physical-path error.
Set requires_dict_downcast for attribute + literal mixes.

Add parser and expr execution tests.

Signed-off-by: Parameshwaran Krishnasamy <Parameshwaran.K@ibm.com>
@Paramesh324 Paramesh324 requested a review from a team as a code owner May 8, 2026 06:51
@github-actions github-actions Bot added rust Pull requests that update Rust code query-engine Query Engine / Transform related tasks query-engine-columnar Columnar query engine which uses DataFusion to process OTAP Batches opl-parser Work items related to OPL Parser labels May 8, 2026
@Paramesh324
Copy link
Copy Markdown
Author

@cijothomas @albertlockett Requesting to review this. Thanks!

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 88.23529% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.21%. Comparing base (be41f5c) to head (8414d85).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2905      +/-   ##
==========================================
+ Coverage   86.14%   86.21%   +0.06%     
==========================================
  Files         707      715       +8     
  Lines      267469   271809    +4340     
==========================================
+ Hits       230419   234327    +3908     
- Misses      36526    36958     +432     
  Partials      524      524              
Components Coverage Δ
otap-dataflow 87.16% <88.23%> (+0.05%) ⬆️
query_abstraction 80.61% <ø> (ø)
query_engine 90.73% <ø> (ø)
otel-arrow-go 52.45% <ø> (ø)
quiver 92.25% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

opl-parser Work items related to OPL Parser query-engine Query Engine / Transform related tasks query-engine-columnar Columnar query engine which uses DataFusion to process OTAP Batches rust Pull requests that update Rust code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[OPL/OTAP query-engine functions] coalesce

1 participant